﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Common;
using System.Linq;
using System.Text;
using MetaContainer;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace Samples.MetaContainer.EnterpriseLibrary.Adapter
{
   public static class DataAccessMetaContainerExtensions
   {
      public static IMetaContainer SetUpDAAB(this IMetaContainer container)
      {
         container.Register<Database>(CreateDatabase);
         return container;
      }

      private static Database CreateDatabase(string name)
      {
         if (name != null)
         {
            return DatabaseFactory.CreateDatabase(name);
         }
         return DatabaseFactory.CreateDatabase();
      }
   }
}
